-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the HTML encoding when uploading a folder in FF when using french… #460
Fix the HTML encoding when uploading a folder in FF when using french… #460
Conversation
That was a quick fix. Thank you, it works perfectly. |
message: data.errorThrown | ||
}); | ||
}, undefined, {escape: false}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got to say that I consider this a kinda risky chance. While data.errorThrown
may right now not echo back user controlled input this has still the potential to do bad things in the future… 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do that at
server/apps/files/js/file-upload.js
Lines 357 to 360 in 45c99c2
data.errorThrown = t('files', | |
'Unable to upload {filename} as it is a directory or has 0 bytes', | |
{filename: file.name} | |
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file name is already escaped there, it is also escaped here.
The problem is, that the actual translation contains the '
, and when using that string here as a parameter in the translation, it is html encoded and displayes as &#...;
. So not sure how this could be fixed on the other place, if this place breaks it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simply unescape
server/apps/files/js/file-upload.js
Lines 357 to 360 in 45c99c2
data.errorThrown = t('files', | |
'Unable to upload {filename} as it is a directory or has 0 bytes', | |
{filename: file.name} | |
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha… Gotcha now… Let me think…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unescape what? the unescape option only affects parameters, but the parameter is not the problem. Also the value in data.errorThrown
here is not a problem, it's still what we would display in the UI. It's the t()
method here, which takes the translated string as an argument and thereby s/'/&#..;
the first translation. TO avoid this I removed escaping from all parameters and only escaped the file name, since the string here is only translator controlled, not user controlled, we can and have to trust it anyway....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. You're right. This is also properly escaped all since we don't use showHTML. (so even when passing HTML strings this shouldn't be rendered as HTML anyways)
👍 |
@nickvergessen @LukasReschke Backport? |
… l10n
Fix #459
Please review @tflidd